package com.camunda7.workflow;

import org.camunda.bpm.engine.spring.SpringProcessEngineConfiguration;
import org.camunda.bpm.spring.boot.starter.configuration.impl.DefaultProcessEngineConfiguration;
import org.springframework.context.annotation.Configuration;

@Configuration
public class CamundaConfig extends DefaultProcessEngineConfiguration {

    @Override
    public void preInit(SpringProcessEngineConfiguration configuration) {
        super.preInit(configuration);

        //启用历史清理
        configuration.setHistoryCleanupEnabled(true);

        //清理窗口的时间
        configuration.setHistoryCleanupBatchWindowStartTime("00:00");
        configuration.setHistoryCleanupBatchWindowEndTime("01:00");
        configuration.setHistoryTimeToLive("P365D"); // 设置历史数据保留7天

    }
}
